package com.simpletour.qa.service.repository;

import com.simpletour.qa.service.entity.QuestionLike;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface QuestionLikeRepository extends JpaRepository<QuestionLike,Integer> {


    @Query("select count(questionId) from QuestionLike where questionId = :questionId")
    int findCountByQuestionId(@Param("questionId") int questionId);

    void deleteByUserIdAndQuestionId(int userId,int questionId);


    @Query("select count(questionId) from QuestionLike where userId = :userId and questionId = :questionId")
    int findCountByUserIdAndQuestionId(@Param("userId")int userId,@Param("questionId")int questionId);
}
